package com.travelplanning.admin.controller;

import com.travelplanning.admin.common.convention.Result;
import com.travelplanning.admin.common.convention.Results;
import com.travelplanning.admin.dto.req.ContentAddReqDTO;
import com.travelplanning.admin.dto.req.OrderAddReqDTO;
import com.travelplanning.admin.dto.resp.ContentQueryRespDTO;
import com.travelplanning.admin.dto.resp.OrderQueryRespDTO;
import com.travelplanning.admin.service.OrderService;
import com.travelplanning.admin.service.UserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Tag(name = "订单相关接口")
@RestController
@RequiredArgsConstructor
public class OrderController {
    private final OrderService orderService;
    /**
     * 新增订单
     */
    @Operation(summary = "新增订单")
    @PostMapping("/api/travel-planning/v1/order/save")
    public Result<Void> addOrder(@RequestBody OrderAddReqDTO requestparam ){
        orderService.addOrder(requestparam);
        return Results.success();
    }

    @Operation(summary = "查询所有订单")
    @PostMapping ("/api/travel-planning/v1/order/queryOrder")
    public Result<List<OrderQueryRespDTO>> queryOrderById() {

        return Results.success( orderService.QueryOrder());
    }


}
